package com.alog.senior.day15;

import java.util.*;

/**
 * @Auther: Ye Zhengdong
 * @Date: 2019/1/22 15:17
 * @Description:
 */
public class DouDiZhi2 {
    public static void main(String[] args) {
        Map<Integer, String> poker = new HashMap<>();

        List<Integer> pokerIndexs = new ArrayList<>();

        List<String> colors = List.of("♥", "♦", "♠", "♣");
        List<String> nums = List.of("2", "A", "3", "4","5", "6", "7", "8","9", "10", "J", "Q", "K");

        int index = 0;
        poker.put(index, "大王");
        pokerIndexs.add(index);
        index++;
        poker.put(index, "小王");
        pokerIndexs.add(index);
        index++;

        for(String num : nums){
            for(String color : colors){
                poker.put(index, color + num);
                pokerIndexs.add(index);
                index++;
            }
        }
//        System.out.println(poker);
//        System.out.println(pokerIndexs);

        Collections.shuffle(pokerIndexs);

        List<Integer> player1 = new ArrayList<>();
        List<Integer> player2 = new ArrayList<>();
        List<Integer> player3 = new ArrayList<>();
        List<Integer> dipai = new ArrayList<>();
        for(int i = 0 ; i < pokerIndexs.size(); i++){
            if(i >= 51){
                dipai.add(pokerIndexs.get(i));
                continue;
            }
            switch (i % 3){
                case 0 :
                    player1.add(pokerIndexs.get(i));
                    break;
                case 1 :
                    player2.add(pokerIndexs.get(i));
                    break;
                case 2 :
                    player3.add(pokerIndexs.get(i));
                    break;
            }

        }

        Collections.sort(player1);
        Collections.sort(player2);
        Collections.sort(player3);
        Collections.sort(dipai);

        lookPoker("xxx", poker, player1);
        lookPoker("YYY", poker, player2);
        lookPoker("ZZZ", poker, player3);
        lookPoker("KKK", poker, dipai);

    }

    public static void lookPoker(String name, Map<Integer, String> poker, List<Integer> player){
        System.out.print(name + ":[ ");
        for(Integer i : player){
            System.out.print(poker.get(i) + " ");
        }
        System.out.println("]");
    }
}
